<template>
<div>
  <div class="commont">
   <header class="comHead">
      <div class="qoutTitleBox">
        <span class="mainTitle">{{title}}</span>
        <span v-if="subTitle" class="subTitle">{{subTitle}}</span>
      </div>
      <div v-if="showSearch" class="newsSearch">
        <span @click.stop="searchNews" class="searchIcon el-icon-search"></span>
        <span class="searchInput">
          <input class="inputItem" v-model="searchValue" type="text" @keyup.enter="searchNews" placeholder="搜索">
        </span>
      </div>
   </header>
   <div>
     <slot>empty</slot>
   </div>
 </div>
</div>
</template>
<script>
export default {
  props: {
    title: {
      type: String
    },
    showSearch: {
      type: Boolean
    },
    subTitle: {
      type: String
    }
  },
  data () {
    return {
      searchValue: ''
    };
  }
};
</script>
<style lang="less" rel="stylesheet/less" scoped>
.commont{
  padding: 0 10px 20px;
  margin-bottom: 10px;
  background: #1f2533;
  .comHead{
    height: 34px;
    font-size: 14px;
    line-height: 34px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .newsSearch{
      width: 138px;
      height: 24px;
      line-height: 24px;
      display: flex;
      align-items: center;
      border: 1px solid #99a3bb;
      .searchInput{
        line-height: 24px;
        .searchIcon{
          display: inline-block;
          width: 16px;
          height: 16px;
          font-size: 16px;
          padding: 4px;
        }
        .inputItem{
          -webkit-appearance: none;
          outline: none;
          border: none;
          box-sizing: content-box;
          height: 24px;
          line-height: 24px;
          background: inherit;
          width: 100px;
          color: #fff !important;
        }
      }
      .searchIcon{
        font-size: 16px;
        color: #99a3bb;
        line-height: 24px;
      }
    }
    .qoutTitleBox{
      .mainTitle{
        color: #fff;
      }
      .subTitle{
        color: #99a3bb;
        margin-left: 100px;
      }
    }

  }
}
</style>